//
//  DebugViewCell.m
//  sHome
//
//  Created by tracyhenry on 2021/3/13.
//  Copyright © 2021 SiterWell. All rights reserved.
//

#define RGBA(r,g,b,a) [UIColor colorWithRed:r/255.0f green:g/255.0f blue:b/255.0f alpha:a]
#define SYSTEMFONT(FONTSIZE)     [UIFont systemFontOfSize:FONTSIZE]


#import "DebugViewCell.h"
#import <Masonry/Masonry.h>

@implementation DebugViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if(self=[super initWithStyle:style reuseIdentifier:reuseIdentifier]){
        [self initview];
    }
    return self;
}

-(void)initview{

    self.contentView.backgroundColor = RGBA(255, 255, 255, 0.0f);
    self.signalBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.signalBtn setBackgroundColor:[UIColor redColor]];
    self.signalBtn.layer.cornerRadius = 5.0f;
    [self.signalBtn setTitle:@"R" forState:UIControlStateNormal];
    [self.signalBtn setFont:SYSTEMFONT(12)];
    [self.contentView addSubview:self.signalBtn];
    [self.signalBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.height.mas_equalTo(20);
        make.left.mas_equalTo(self.contentView.mas_left).offset(5);
        make.top.mas_equalTo(self.contentView.mas_top).offset(5);

    }];
    
    self.tcpBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.tcpBtn setBackgroundColor:[UIColor greenColor]];
    self.tcpBtn.layer.cornerRadius = 5.0f;
    [self.tcpBtn setTitle:@"TCP" forState:UIControlStateNormal];
    [self.tcpBtn setFont:SYSTEMFONT(12)];
    [self.contentView addSubview:self.tcpBtn];
    [self.tcpBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.mas_equalTo(20);
        make.width.mas_equalTo(35);
        make.right.mas_equalTo(self.contentView.mas_right).offset(-5);
        make.top.mas_equalTo(self.contentView.mas_top).offset(5);

    }];
    
    
    self.timeLabel = [[UILabel alloc] init];
    self.timeLabel.font = SYSTEMFONT(13);
    self.timeLabel.textColor = [UIColor whiteColor];
    [self.contentView addSubview:self.timeLabel];
    [self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self.signalBtn.mas_centerY);
        make.left.mas_equalTo(self.signalBtn.mas_right).offset(8);
    }];
    
    self.contentLabel = [[UILabel alloc] init];
    self.contentLabel.textColor = [UIColor whiteColor];
    self.contentLabel.font = SYSTEMFONT(14);
    self.contentLabel.numberOfLines = 0;
    [self.contentView addSubview:self.contentLabel];
    [self.contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.timeLabel.mas_bottom).offset(5);
        make.left.mas_equalTo(self.contentView.mas_left).offset(8);
        make.right.mas_equalTo(self.contentView.mas_right).offset(-8);
    }];
}

@end

